package org.jivesoftware.smackx.workgroup.agent;

import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;

public class WorkgroupQueue
{
  private int averageWaitTime;
  private int currentChats;
  private int maxChats;
  private String name;
  private Date oldestEntry;
  private Status status = Status.CLOSED;
  private Set users;

  WorkgroupQueue(String paramString)
  {
    this.averageWaitTime = -1;
    this.oldestEntry = null;
    this.users = Collections.EMPTY_SET;
    this.maxChats = 0;
    this.currentChats = 0;
    this.name = paramString;
  }

  public int getAverageWaitTime()
  {
    return this.averageWaitTime;
  }

  public int getCurrentChats()
  {
    return this.currentChats;
  }

  public int getMaxChats()
  {
    return this.maxChats;
  }

  public String getName()
  {
    return this.name;
  }

  public Date getOldestEntry()
  {
    return this.oldestEntry;
  }

  public Status getStatus()
  {
    return this.status;
  }

  public int getUserCount()
  {
    int i;
    if (this.users == null)
      i = 0;
    while (true)
    {
      return i;
      i = this.users.size();
    }
  }

  public Iterator getUsers()
  {
    Iterator localIterator;
    if (this.users == null)
      localIterator = Collections.EMPTY_SET.iterator();
    while (true)
    {
      return localIterator;
      localIterator = Collections.unmodifiableSet(this.users).iterator();
    }
  }

  void setAverageWaitTime(int paramInt)
  {
    this.averageWaitTime = paramInt;
  }

  void setCurrentChats(int paramInt)
  {
    this.currentChats = paramInt;
  }

  void setMaxChats(int paramInt)
  {
    this.maxChats = paramInt;
  }

  void setOldestEntry(Date paramDate)
  {
    this.oldestEntry = paramDate;
  }

  void setStatus(Status paramStatus)
  {
    this.status = paramStatus;
  }

  void setUsers(Set paramSet)
  {
    this.users = paramSet;
  }

  public static class Status
  {
    public static final Status ACTIVE;
    public static final Status CLOSED;
    public static final Status OPEN = new Status("open");
    private String value;

    static
    {
      ACTIVE = new Status("active");
      CLOSED = new Status("closed");
    }

    private Status(String paramString)
    {
      this.value = paramString;
    }

    public static Status fromString(String paramString)
    {
      Status localStatus;
      if (paramString == null)
        localStatus = null;
      while (true)
      {
        while (true)
        {
          String str;
          while (true)
          {
            while (true)
            {
              return localStatus;
              str = paramString.toLowerCase();
              if (!(OPEN.toString().equals(str)))
                break;
              localStatus = OPEN;
            }
            if (!(ACTIVE.toString().equals(str)))
              break;
            localStatus = ACTIVE;
          }
          if (!(CLOSED.toString().equals(str)))
            break;
          localStatus = CLOSED;
        }
        localStatus = null;
      }
    }

    public String toString()
    {
      return this.value;
    }
  }
}